import tpl from './index.tpl'
import './index.scss'

import { tplReplace } from '../../utils/tools'

import list from './list'
import indicator from './indicator'

export default (swiperData) => {

    const listComponent = list(),
          indicatorComponent  = indicator();
    
    return {
        name: 'carousel',
        tpl () {
            return tplReplace(tpl, {
                listWidth: (swiperData.length + 1) * 1200,
                list: listComponent.tpl(swiperData),
                indicator: indicatorComponent.tpl(swiperData)
            })
        }
    }
}